package com.demo.startup;

import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

@SuppressWarnings("unused")
@Component
public class CustomBeanPostProcessor implements BeanPostProcessor {

    // simply return the instantiated bean as-is
    public Object postProcessBeforeInitialization(Object bean, String beanName) {
        System.out.println("--BeanPostProcessor '" + beanName + "' --initialization: " + beanName.toString());
        return bean;
    }

    public Object postProcessAfterInitialization(Object bean, String beanName) {
        System.out.println("--BeanPostProcessor '" + beanName + "' --created: " + beanName.toString());
        return bean;
    }
}
